package com.example.test_system.api;

import com.example.test_system.model.Question;
import com.example.test_system.service.PaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class PaperController {

    @Autowired
    PaperService paperService;

    @ResponseBody
    @GetMapping("/getPaper")
    public Map<String, Object> getPaper(){

        Map<String, List> paper = paperService.getPaper();

        Map<String, Object> res = new HashMap<>();

        res.put("state", "ok");
        res.put("questions", paper);

        return res;
    }
}
